<?php echo CHtml::beginForm('', 'post', array
('enctype' => 'multipart/form-data'))?>
<? $this->widget('ext.EAjaxUpload.EAjaxUpload',
    array(
        'id' => 'uploadFile',
        'config' => array(
            'action' => Yii::app()->createUrl('upload/upload', array('ctype' => 'training')),
            'allowedExtensions' => array("jpg", "png"), //array("jpg","jpeg","gif","exe","mov" and etc...
            'sizeLimit' => 1 * 1024 * 1024, // maximum file size in bytes
            'minSizeLimit' => 10 * 1024, // minimum file size in bytes
            'onComplete' => "js:function(id, fileName, responseJSON){ alert(responseJSON.item_id); }",
        )
    )); ?>
<?php echo CHtml::error($model, 'file') ?>
<?php echo CHtml::activeFileField($model, 'file') ?>
<?php echo CHtml::ajaxSubmitButton('Upload', $this->createUrl('/upload/image'), array('contentType' => 'multipart/form-data')) ?>
<?php echo CHtml::endForm() ?>